package com.runchinaup.textapp;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.PopupWindow;

/**
 * Created by liber on 2018/3/29.
 */

public class MyPopwindow {

    private Context context;

    private static MyPopwindow myPopwindow;

    private MyPopwindow(Context context) {
        this.context = context;
    }

    public static MyPopwindow getMyPopwindow(Context context) {
        synchronized (Void.class) {
            if (myPopwindow == null) {
                synchronized (Void.class) {
                    myPopwindow = new MyPopwindow(context);
                }
            }
        }
        return myPopwindow;
    }

    private PopupWindow popupWindow;

    public MyPopwindow showPopWindow(View refLayout) {
        View view = LayoutInflater.from(context).inflate(R.layout.pop_menu, null);
        popupWindow = new PopupWindow(view, ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT, true);
        popupWindow.setFocusable(true);
        popupWindow.setOutsideTouchable(true);
        popupWindow.setAnimationStyle(R.style.pop_window);

        popupWindow.showAsDropDown(refLayout,0,0, Gravity.LEFT);

        return null;
    }

    public  static abstract class ClickCallback{

    }


}
